<template>
  <div class="fareDifferencesInAudit">
    <basic-container>
      <avue-crud
        ref="fareDifferencesInAudit"
        :option="option"
        :table-loading="listLoading"
        :data="list"
	:permission="permissionList"
        :page.sync="page"
        :search.sync="searchForm"
        @search-change="handleFilter"
        @selection-change="selectionChange"
        @refresh-change="refreshChange"
        @on-load="refreshChange"
        :row-style="rowStyle"
        :cell-style="cellStyle">
        <template slot="menuRight">
          <el-button
            class="filter-item"
            type="primary"
            size="mini"
            @click="clickFun()">分钱箱批量审批
          </el-button>
          <el-button
            class="filter-item"
            type="primary"
            size="mini"
            v-if="false"
            @click="clickDifferences()">设置差异原因
          </el-button>
          <el-button type="primary" size="mini" @click="submitData()">加入报表差错</el-button>
          <el-button type="primary" size="mini" @click="jiaRuNotice()">加入通知</el-button>
          <el-button
            class="filter-item"
            type="primary"
            size="mini"
            @click="clickAudit()">一键审核
          </el-button>
          <el-button type="primary" size="mini"  @click="revoke">撤回审核</el-button>
          <el-button
            class="filter-item"
            type="primary"
            size="mini"
            v-if="false"
            @click="clickCheckTheDocumentsInvestigation('1')">结账单据协查
          </el-button>
          <el-button
            class="filter-item"
            type="primary"
            size="mini"
            @click="clickLevelDifferenceInvestigation()">层级差异协查
          </el-button>
<!--          <el-button-->
<!--            class="filter-item"-->
<!--            type="primary"-->
<!--            size="mini"-->
<!--            @click="clickCheckTheDocumentsInvestigation('2')">单台设备差异协查-->
<!--          </el-button>-->
          <el-button
            class="filter-item"
            type="primary"
            size="mini"
            @click="openDanTaiSheBeiXieCha()">单台设备差异协查
          </el-button>
          <el-button
            class="filter-item"
            type="primary"
            size="mini"
            @click="cancellationData()">作废TVM数据
          </el-button>
	  <el-button
            class="filter-item"
            type="primary"
            size="mini"
            @click="handleDelete()">删除
          </el-button>
	   <el-button
            class="filter-item"
            type="primary"
            size="mini"
	    v-permission="permissionList.highDelTvmRepeatData"
            @click="handleTvmDelete()">删除重复数据
          </el-button>
          <el-button
            class="filter-item"
            type="primary"
            size="mini"
            @click="exportExcel()">导出
          </el-button>
        </template>
        <template slot-scope="scope" slot="lineCodeSearch">
          <el-select v-model="searchForm.lineCode" placeholder="请选择" style="width: 150px" @change="changeLine" clearable filterable>
            <el-option
              v-for="(item,index) in lineCodes"
              :key="index"
              :label="item.name"
              :value="item.code">
            </el-option>
          </el-select>
        </template>
        <template slot-scope="scope" slot="stationCodeSearch">
          <el-select v-model="searchForm.stationCode" placeholder="请选择" style="width: 150px" clearable @change="changeStation" filterable>
            <el-option
              v-for="(item,index) in stationCodes"
              :key="index"
              :label="item.name"
              :value="item.code">
            </el-option>
          </el-select>
        </template>
        <template slot-scope="scope" slot="tvmCodeSearch">
          <el-select v-model="searchForm.tvmCode" placeholder="请选择" style="width: 150px" clearable filterable>
            <el-option
              v-for="(item,index) in tvmCodes"
              :key="index"
              :label="item.tvmCode"
              :value="item.tvmCode">
            </el-option>
          </el-select>
        </template>
        <template slot="search" slot-scope="{row,size}" >
          <el-form-item label="差异条件" style="width: 200px">
            <el-select v-model="searchForm.isDiffMoney" placeholder="请选择" style="width: 200px" clearable>
              <el-option label="不等于0" value="0"></el-option>
              <el-option label="等于0" value="1"></el-option>
              <!-- <el-option label="大于0" value="2"></el-option> -->
            </el-select>
          </el-form-item>
        </template>
        <template
          slot="tvmCode"
          slot-scope="{row}"
        >
          <el-tooltip class="item" effect="dark" content="钱箱清点信息" placement="right-end">
            <el-link
              type="primary"
              @click="previewTVM(row)"
            >{{row.tvmCode}}</el-link>
          </el-tooltip>
        </template>
        <template
          slot="handOutMoney"
          slot-scope="{row}"
        >
          <el-tooltip class="item" effect="dark" content="手工清出信息" placement="right-end">
            <el-link
              type="primary"
              @click="preview(row.handOutMoneyUrl, row)"
            >{{row.handOutMoney | rcaNumberFormat}}</el-link>
          </el-tooltip>
        </template>
        <template slot="searchMenu" slot-scope="{row,size}">
          <el-button :size="size" @click="()=>{setSearchFiledsEmpty(row);setSearchFiledsEmpty(searchForm);getList()}" icon="el-icon-delete">清空</el-button>
        </template>
        <template slot-scope="scope" slot="menu">
          <el-button type="text" size="small" plain v-if="scope.row.auditStatus==0"  @click="rowEditor(scope.row,scope.row.dataSource)">编辑</el-button>
          <el-button type="text" size="small" plain @click.stop="openPastRecords(scope.row)">查看历史记录</el-button>
          <el-button type="text" size="small" v-if="scope.row.isAddSettleorderAssist==1" plain @click.stop="previewEditor(scope.row,1)">结账单据协查信息</el-button>
          <el-button type="text" size="small" v-if="scope.row.isAddScLevelAssist==1 || scope.row.isAddLcLevelAssist==1 || scope.row.isAddAccLevelAssist==1" plain @click.stop="clickLevelDifferenceInvestigationRedio(scope.row)">层级差异协查信息</el-button>
          <el-button type="text" size="small" v-if="scope.row.isAddSinglerAssist==1" plain @click.stop="previewEditor(scope.row,3)">单台差异协查信息</el-button>
          <el-button type="text" size="small" v-if="scope.row.noticeSate > 1" plain @click.stop="previewNotice(scope.row)">TVM确认通知信息</el-button>
          <el-button type="text" size="small" plain @click.stop="openReplace(scope.row)">数据来源替换</el-button>
        </template>
      </avue-crud>
    </basic-container>
    <el-dialog
      title="设置差异原因"
      :visible.sync="dialogVisible"
      width="30%" >
      <el-input
        type="textarea"
        :rows="5"
        placeholder="请输入内容"
        v-model="textarea">
      </el-input>
      <template>
        <el-button
          class="filter-item"
          type="primary"
          size="mini"
          @click="submitDifferences()">确定</el-button>
      </template>
    </el-dialog>
    <el-dialog
      title="选择层级"
      :visible.sync="dialogVisibleLevel"
      width="30%" >
      <template>
        <div style="margin: 15px 0;"></div>
        <el-checkbox-group v-model="checkedLevels" @change="handleCheckedCitiesChange">
          <el-checkbox v-for="level in levels" :label="level" :key="level">{{level}}</el-checkbox>
        </el-checkbox-group><br/>
        <el-button
          class="filter-item"
          type="primary"
          size="mini"
          @click="submitLevel()">确定</el-button>
      </template>
    </el-dialog>
    <el-dialog
      title="选择层级"
      :visible.sync="dialogVisibleLevelRadio"
      width="30%" >
      <template>
        <div style="margin: 15px 0;"></div>
        <el-radio-group v-model="levelRadio">
          <!-- <el-radio :label="2">SC</el-radio> -->
          <el-radio :label="3">SC-LC</el-radio>
          <el-radio :label="4">LC-ACC</el-radio>
        </el-radio-group>
        <br/>
        <el-button
          class="filter-item"
          type="primary"
          size="mini"
          @click="submitLevelRedio()">查看</el-button>
      </template>
    </el-dialog>

    <el-dialog
      title="单台设备差异协查"
      :visible.sync="danTaiSheBeiXieCha"
      @close="closeDanTaiSheBeiXieCha"
      width="950px">
      <el-form :model="danTaiSheBeiXieChaData">
        <el-form-item label="车站备注" prop="remark">
          <el-input type="textarea"
                    placeholder="请输入车站备注"
                    class="custom-textarea"
                    v-model="danTaiSheBeiXieChaData.remark"></el-input>
        </el-form-item>
      </el-form>
      <div class="bottom-menu-hand">
        <el-button type="primary" @click="clickCheckTheDocumentsInvestigation('2')"
        >保存</el-button
        >
        <el-button type="primary" @click="closeDanTaiSheBeiXieCha"
        >返回</el-button
        >
      </div>
    </el-dialog>

    <el-dialog
      title="数据来源替换"
      :visible.sync="dialogVisibleLevelReplace.dialogVisible"
      width="30%" >
      <template>
        <div style="text-align: center">
        <el-select v-model="dialogVisibleLevelReplace.dataSource" placeholder="请选择">
          <el-option
            v-for="(item,index) in dialogVisibleLevelReplace.levels"
            :key="index"
            :label="item.label"
            :value="item.value">
          </el-option>
        </el-select>
        <br/>
        <el-button
          style="margin-top: 30px"
          class="filter-item"
          type="primary"
          size="mini"
          @click="replaceCengJiDatasource()">确定</el-button>
        </div>
      </template>
    </el-dialog>
    <open-dialog
        :DialogVisible.sync="editVisableDialog"
        title="编辑"
        width="60%"
        :before-close="closeDialog"
      >
      <el-form label-width="60px" v-if="editVisableDialog">
        <avue-form
          v-model="formEdit"
          :option="tableOptionEditTvm"
          style="margin-bottom: 40px"
        ></avue-form>
        <div class="bottom-menu">
          <el-button type="primary" @click="edit">保存</el-button>
          <el-button type="primary" @click="closeDialog"
            >取消</el-button
          >
        </div>
      </el-form>
      </open-dialog>
      <open-dialog
          :DialogVisible.sync="handCleanVisableDialog"
          title="手工清出详情"
          width="60%"
        :before-close="closehandCleanDialog"
        >
        <avue-crud :data="handCleanData" :option="tableOptionView" title="手工清出明细"></avue-crud>
        <div class="bottom-menu-hand">
          <el-button type="primary" @click="closehandCleanDialog"
            >返回</el-button
          >
        </div>
      </open-dialog>
      <open-dialog
          :DialogVisible.sync="tvmCheckVisableDialog"
          title="TVM钱箱清点详情"
          width="60%"
        :before-close="closetvmCheckDialog"
        >
        <el-form v-if="tvmCheckVisableDialog">
          <avue-form
            v-model="formtvmCheck"
            :option="tvmCheckOptionView"
            style="margin-top:38px"
          ></avue-form>
        </el-form>
        <el-tabs v-model="active" v-if="tvmCheckVisableDialog" style="margin-top: -40px;">
          <el-tab-pane label="硬币回收箱" name="1" style="margin-top: -40px;">
            <dynamic-crud
              :data="coinData"
              :option="tvmCheckOptionDetailView"
            ></dynamic-crud>
          </el-tab-pane>
          <el-tab-pane label="硬币补充箱" name="2" style="margin-top: -40px;">
            <dynamic-crud
              :data="coinChangeData"
              :option="tvmCheckOptionDetailView"
            ></dynamic-crud>
          </el-tab-pane>
          <el-tab-pane label="纸币回收箱" name="3" style="margin-top: -40px;">
            <dynamic-crud
              :data="paperData"
              :option="tvmCheckOptionDetailView"
            ></dynamic-crud>
          </el-tab-pane>
          <el-tab-pane label="纸币找零箱" name="4" style="margin-top: -40px;">
            <dynamic-crud
              :data="paperChangeData"
              :option="tvmCheckOptionDetailView"
            ></dynamic-crud>
          </el-tab-pane>
          <el-tab-pane label="废钞箱" name="5" style="margin-top: -40px;">
            <dynamic-crud
              :data="wasteData"
              :option="tvmCheckOptionDetailView"
            ></dynamic-crud>
          </el-tab-pane>
        </el-tabs>
        <div class="bottom-menu-tvm">
          <el-button type="primary" @click="closetvmCheckDialog"
            >返回</el-button
          >
        </div>
      </open-dialog>
     <open-dialog
        :DialogVisible.sync="visableDialogRecordsTVM"
        title="查看历史记录"
        width="60%"
      >
        <avue-crud
          :data="tableData"
          :option="tableOptionEditRecordsTvm">
        </avue-crud>
        <div class="bottom-menu-close">
          <el-button type="primary" @click="visableDialogRecordsTVM=false"
            >取消</el-button
          >
        </div>
      </open-dialog>
    <replace ref="replace" v-if="isShowReplace"></replace>
    <prev ref="prev" v-if="dialogVisibleprev"></prev>
    <addReportEditor ref="addReportEditor" @addReportSuccess="getList"></addReportEditor>
    <HuikuiInfo ref="HuikuiInfo" v-if="isShowDia"></HuikuiInfo>
    <HuikuiInfoSC_LC ref="HuikuiInfoSC_LC" v-if="isShowDiaSC_LC"></HuikuiInfoSC_LC>
    <HuikuiInfoLC_ACC ref="HuikuiInfoLC_ACC" v-if="isShowDiaLC_ACC"></HuikuiInfoLC_ACC>
  </div>

</template>

<script>
  import {exportDataToExcel} from "../../../../api/subwayRat/exportSelf";
  import {getForm, postForm} from '@/api/gen/gen'
  import {mapGetters} from 'vuex';
  import replace from './replace';
  import {
    tvmCheckOptionView,
    tableOption,
    tableOptionEditTvm,
    tableOptionEditRecordsTvm,
    getFareDifferencesInAudit,
    update,
    updateDifferences,
    updateAuditStatusDefference,
    insertCheckTheDocumentsInvestigation,
    insertSwAuTvmCashAmountHierarchyDifference,
    replaceCengJiDatasourceSwAuTvmCashAmountHierarchyDifference,
    jiaRuNoticeTvm,
    formOptionView,
    tableOptionView,
    tvmCheckOptionDetailView,
    fetchList,
    getTvmList,
    queryTVM,
    getObj,
    getTvmObj,
    revoke,
    cancellationTvmDate,
    delObj
  } from '../../../../api/subwayRat/TVMRevenueVarianceAudit/differencesInAudit/fareDifferencesInAudit';
  import transitUtil from "../../../../api/subwayRat/transitUtil";
  import {getSwAuTvmDailyBillAssistList,queryPastRecords} from "../../../../api/subwayRat/TVMRevenueVarianceAudit.TvmChaYiDXC/TvmJiezhangdanjuxiecha";
  import {getSwAuTvmSingleAssistList} from "../../../../api/subwayRat/TVMRevenueVarianceAudit.TvmChaYiDXC/dantaishebeipiaohuanchayi";
  import {getSwAuTvmCashAmountHierarchyDifferenceList} from "../../../../api/subwayRat/TVMRevenueVarianceAudit.TvmChaYiDXC/tvmCengJiCYXC/tvmXianJinCengJiCYDXY/JieZhangDanAndSCCengji";
  import {
    sortWithDiffMoney,
    inner,
    queryMessage,
    getgetStationCodes,
    getLineCodes, getSwPmTvmCodeList,setSearchFiledsEmpty,getStationByCode,getLineAndStationByCode,
  } from "../../../../api/subwayRat/commonCheck";
  import addReportEditor from '@/views/subwayRat/reportMondify/reportMistakeInfo/Editor';
  import { fenExYuangettoFixed,fenExYuangettoFixed2 } from "../../../../api/subwayRat/commonCheck";
  import { dateFormat } from '@/util/date';
  import { rcaNumberFormat } from '@/api/subwayRat/TVMRevenueVarianceAudit/differencesInAudit/common';
  import row from "element-ui/packages/row";
  import moment from "moment";
  import HuikuiInfo
    from "@/views/subwayRat/TVMRevenueVarianceAudit/TvmChaYiDXC/dantaishebeipiaohuanchayi/HuikuiInfo.vue";
  import HuikuiInfoSC_LC from "@/views/subwayRat/TVMRevenueVarianceAudit/differencesInAudit/HuikuiInfoSC_LC.vue";
  import HuikuiInfoLC_ACC from "@/views/subwayRat/TVMRevenueVarianceAudit/differencesInAudit/HuikuiInfoLC_ACC.vue";
  import prev from "@/views/stationTiecketManager/xianWngCJXXQR/tvmPiaoKuanCY/tvmPiaoKuanCYTZ/prev.vue";
  export default {
    components:{
      prev,
      HuikuiInfoLC_ACC,
      HuikuiInfoSC_LC,
      HuikuiInfo,
      replace,addReportEditor
    },
    name: 'fareDifferencesInAudit',
    filters: {
      rcaNumberFormat (val) {
        return rcaNumberFormat(val, true)
      }
    },
    data() {
      return {
        dialogVisibleprev:false,//预览
        isShowDiaLC_ACC:false,
        isShowDiaSC_LC:false,
        isShowDia:false,
        checkAll: false,
        checkedLevels: [],
        tvmCodes:[],
        lineCodes:[],
        stationCodes:[],
        // levels: ['SC', 'LC', 'ACC'],
        levels: ['SC-LC', 'LC-ACC'],
        isIndeterminate: true,
        option: tableOption,
        tableOptionEditTvm: tableOptionEditTvm,
        tableOptionEditRecordsTvm:tableOptionEditRecordsTvm,
        textarea:'',
        listLoading: true,
        dialogVisible:false,
        dialogVisibleLevelRadio:false,
        visableDialogRecords: false,
        visableDialogRecordsTVM: false,
        tableData: [],
        editVisableDialog: false,
        redioRow:{},
        redioType : '',
        levelRadio:3,
        dialogVisibleLevel:false,
        isShowReplace:false,//是否展示替换页面
        dialogVisibleLevelReplace:{ //数据来源替换
          dialogVisible:false,
          dataSource:'',
          levels: [{label:'修正',"value":1}, {label:'SC',"value":2},
            {label:'LC',"value":3}, {label:'ACC',"value":4},{label:'单台设备差异协查结果',value:5},{label:'分钱箱票款差异协查',value:6}],
          row:{}
        },
        danTaiSheBeiXieCha: false,
        searchForm:{
          lineCode:'9',
          stationCode:'',
          tvmCode:'',
          auditStatus:'0',
          isDiffMoney:'0',
        },
        page: {
          total: 0, // 总页数
          currentPage: 1, // 当前页数
          current: 1,// 当前页数
          pageSize: 20, // 每页显示多少条,
          size: 20,// 每页显示多少条
          isAsc: false// 是否倒序
        },
        list : [],
        checkList : [],
        formEdit: {},
        formhandClean: {},
        handCleanData: [],
        danTaiSheBeiXieChaData: {
          remark: ''
        },
        tableDataList: [],
        formOptionView: formOptionView,
        tableOptionView: tableOptionView,
        handCleanVisableDialog: false,
        formtvmCheck: {},
        tvmCheckVisableDialog: false,
        tvmCheckOptionView: tvmCheckOptionView,
        tvmCheckOptionDetailView: tvmCheckOptionDetailView,
        tvmTableData: [],
        active: "1",
        coinData: [],
        coinChangeData: [],
        paperData: [],
        paperChangeData: [],
        wasteData: [],
      }
    },
    computed: {
          ...mapGetters(['permissions']),
          permissionList () {
            return {
                highDelTvmRepeatData: this.vaildData(
                this.permissions.highDelTvmRepeatData,
                false
              ),
            };
          }
        },
    watch: {
      formEdit: {
        handler() {
          //结账单据
          if(this.formEdit.dataSource == '1'){
              //系统金额 = （售票+充值+退款）   自动计算
              this.formEdit.systemMoney = this.formEdit.tvmBillCashReturn + this.formEdit.tvmBillCashRecharge + this.formEdit.tvmBillCashSellTicket;
              //差异金额 = 实点金额-系统金额    自动计算
              this.formEdit.diffMoney = this.formEdit.actualMoney - this.formEdit.systemMoney;
          }
          //SC
          if(this.formEdit.dataSource == '2'){
              //系统金额 = （售票+充值+退款）   自动计算
              this.formEdit.systemMoney = this.formEdit.scCashReturn + this.formEdit.scCashRecharge + this.formEdit.scCashSellTicket;
              //差异金额 = 实点金额-系统金额   自动计算
              this.formEdit.diffMoney = this.formEdit.actualMoney - this.formEdit.systemMoney;
          }
          //LC
          if(this.formEdit.dataSource == '3'){
              //系统金额 = （售票+充值+退款）   自动计算
              this.formEdit.systemMoney = this.formEdit.lcCashReturn + this.formEdit.lcCashRecharge + this.formEdit.lcCashSellTicket;
              //差异金额 = 实点金额-系统金额    自动计算
              this.formEdit.diffMoney = this.formEdit.actualMoney - this.formEdit.systemMoney;
          }
          //ACC
          if(this.formEdit.dataSource == '4'){
              //系统金额 = （售票+充值+退款）   自动计算
              this.formEdit.systemMoney = this.formEdit.accCashReturn + this.formEdit.accCashRecharge + this.formEdit.accCashSellTicket;
              //差异金额 = 实点金额-系统金额    自动计算
              this.formEdit.diffMoney = this.formEdit.actualMoney - this.formEdit.systemMoney;
          }
        },
        immediate: true,
        deep: true
      },
    },
    created() {
      this.changeLine("9")
    },
    mounted() {
      getLineCodes().then(res=>{ //获取线路
        this.lineCodes=res;
      });
    },
    methods: {
      //颜色特殊标识
      rowStyle({ row, column, rowIndex }) {
        if (row.isModify == 0) {
          return {
            backgroundColor: "#eee",
            color: "red",
          };
        }
      },
      setSearchFiledsEmpty,
      changeStation(v){ //改变站点
        let param={};
        param.lineCode=this.searchForm.lineCode;
        param.stationCode=v;
        getSwPmTvmCodeList(param).then(r=>{
          this.tvmCodes=r.data;
        });
      },
      changeLine(v){ //改变线路时
        getgetStationCodes(v).then(res=>{
          this.stationCodes=res;
          this.searchForm.stationCode='';
        })
      },
      async cancellationData(){
        if(this.checkList.length == 0){
          this.$message({message: '请勾选数据',type: 'warning'});
          return;
        }
        if(this.checkList.length > 1){
          this.$message({message: '只能勾选一条数据',type: 'warning'});
          return;
        }
        for(let i=0;i<this.checkList.length;i++){
          if(this.checkList[i].auditStatus==1){
            this.$message.warning("请选择未审核的数据！");
            return;
          }
        }
        let res = await this.$confirm('是否确认作废此TVM的所有数据？', '提示', {
          confirmButtonText: '是',
          cancelButtonText: '否',
          type: 'warning'
        });
        if (!res) {
          return;
        }
        let params = this.checkList[0];
        cancellationTvmDate(params).then((response) => {
          this.getList();
          this.$message.success("操作成功！");
        }).catch(e=>{
          this.$message.error("操作失败！");
        })
      },
       //删除重复提交数据
      async handleTvmDelete() {
        if(this.checkList.length == 0){
          this.$message({message: '请勾选数据',type: 'warning'});
          return;
        }
        if(this.checkList.length > 1){
          this.$message({message: '只能勾选一条数据',type: 'warning'});
          return;
        }
        /*
	for(let i =0;i<this.checkList.length;i++){
          if(this.selectKeys[i].auditState==1){
            this.$message.warning("审批通过的数据不允许去重！");
            return;
          }
        }*/
	var ids=[];
        this.checkList.forEach(function (key, val) {
          ids[val] = key.id
        })
        this.$confirm("是否需要去重?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "success"
        }).then(() => {
          delObj({ids: ids,flag:'2'})
            .then(data => {
              if (data.data.code == "0") {
                this.$message.success("去重成功");
              }
              this.getList(this.page);
              done();
            })
            .catch(() => {
              loading();
            });
        });
      },
       //删除
      async handleDelete() {
        if(this.checkList.length == 0){
          this.$message({message: '请勾选数据',type: 'warning'});
          return;
        }
        if(this.checkList.length > 1){
          this.$message({message: '只能勾选一条数据',type: 'warning'});
          return;
        }
        for(let i=0;i<this.checkList.length;i++){
          if(this.checkList[i].auditStatus==1){
            this.$message.warning("请选择未审核的数据！");
            return;
          }
        }
	var ids=[];
        this.checkList.forEach(function (key, val) {
          ids[val] = key.id
        })
        this.$confirm("是否需要删除?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "success"
        }).then(() => {
          delObj({ids: ids,flag:'1'})
            .then(data => {
              if (data.data.code == "0") {
                this.$message.success("删除成功");
              }
              this.getList(this.page);
              done();
            })
            .catch(() => {
              loading();
            });
        });
      },
      async preview (target, row) {
        let params = {
          lineCode:row.lineCode,
          stationCode:row.stationCode,
          tvmCode: row.tvmCode,
          incomeSettleBeginTime: row.incomeSettleBeginTime,
          incomeSettleEndTime: row.incomeSettleEndTime
        };
        await fetchList(params).then((response) => {
          this.handCleanData = response.data.data;
          this.handCleanVisableDialog = true;
        });
        if(this.handCleanData!=null || this.handCleanData!=undefined){
          // getObj(this.formhandClean.id).then((response) => {
          //   this.handCleanData = response.data.data.details;
          //   this.handCleanVisableDialog = true;
          // });
        }else{
          this.$message.info("没有获取到手工清出信息！");
        }
      },
      async previewTVM (row) {
        let params = {
          lineCode:row.lineCode,
          stationCode:row.stationCode,
          revenueTime:row.recordTime.substr(0, 10),
          tvmCode:row.tvmCode
        };
        await queryTVM(params).then((response) => {
          this.formtvmCheck = response.data.data[0];
        });
        this.tvmCheckVisableDialog = true;
        if(this.formtvmCheck!=null || this.formtvmCheck!=undefined){
          getTvmObj(this.formtvmCheck.id,1).then((res) => {
            this.coinData = res.data.data.swStTvmCheckDetailCoins;
            this.coinChangeData = res.data.data.swStTvmCheckDetailCoinChanges;
            this.paperData = res.data.data.swStTvmCheckDetailPapers;
            this.paperChangeData = res.data.data.swStTvmCheckDetailPaperChanges;
            this.wasteData = res.data.data.swStTvmCheckDetailWastes;
          });
        }else{
          this.$message.info("没有获取到钱箱清点信息！");
        }
      },
      cellStyle({ row, column, rowIndex,columnIndex }) {
        if(7==columnIndex){
          if (row.diffMoney < 0) {
            return {
              color: "red",
            };
          }else if (row.diffMoney > 0) {
            return {
              color: "green",
            };
          }
        }
      },
      async queryPastRecords(row){
        let param={};
        param.id=row.id;
        param.dataSource=row.dataSource;
        await queryPastRecords(param)
          .then(response => {
              this.tableData = response.data.data;
          })
      },
      openReplace(row){
        this.isShowReplace=true;
        this.$nextTick(()=>{
          this.$refs.replace.dialogVisible=true;
          this.$refs.replace.getLists(row);
        })
      },
      openPastRecords(row){
        this.queryPastRecords(row);
        this.visableDialogRecordsTVM=true;
      },
      refreshChange() {
        this.getList()
      },
      clickLevelDifferenceInvestigationRedio(row){
        this.dialogVisibleLevelRadio = true;
        this.redioRow = row;
      },
      submitLevelRedio(){
        this.dialogVisibleLevelRadio = false;
        this.previewEditor(this.redioRow,2);
      },
      openDanTaiSheBeiXieCha(){
        if(this.checkList == 0){
          this.$message({message: '请勾选数据',type: 'warning'});
          return;
        }
        if(this.checkList.length > 1){
          this.$message({message: '只能勾选一条数据',type: 'warning'});
          return;
        }
        for(let i=0;i<this.checkList.length;i++){
          if(this.checkList[i].auditStatus==1){
            this.$message.warning("已审核通过数据不允许再次协查！");
            return;
          }
        }
        let params = {
          lineCode:this.checkList[0].lineCode,
          stationCode:this.checkList[0].stationCode,
          tvmCode: this.checkList[0].tvmCode,
          incomeSettleBeginTime: this.checkList[0].incomeSettleBeginTime,
          incomeSettleEndTime: this.checkList[0].incomeSettleEndTime
        };
        fetchList(params).then((response) => {
          let remark = ''
          for (let i = 0; i < response.data.data.length; i++) {
            if (response.data.data[i].remark != '' && response.data.data[i].remark != null) {
              let formattedCleanTime = moment(response.data.data[i].cleanTime).format('YYYY-MM-DD');
              remark = remark + formattedCleanTime + " " + response.data.data[i].remark + "\n"
            }
          }
          this.danTaiSheBeiXieChaData.remark = remark;
          this.danTaiSheBeiXieChaData.id = this.checkList[0].id;
          this.danTaiSheBeiXieCha = true;
        });
      },
      clickLevelDifferenceInvestigation(){
        if(this.checkList == 0){
          this.$message({message: '请勾选数据',type: 'warning'});
          return;
        }
        for(let i=0;i<this.checkList.length;i++){
          if(this.checkList[i].auditStatus==1){
            this.$message.warning("已审核通过数据不允许再次协查！");
            return;
          }
        }
        this.dialogVisibleLevel = true;
      },
      submitLevel(){
        //层级差异提交
        if(this.checkedLevels == 0){
          this.$message({message: '请勾选层级',type: 'warning'});
          return;
        }
        var ids=[];
        this.checkList.forEach(function (key, val) {ids[val] = key.id})
        var types=[];
        this.checkedLevels.forEach(function (key, val) {types[val] = key})
        let p = {
          ids : JSON.stringify(ids),
          types : JSON.stringify(types)
        };
        insertSwAuTvmCashAmountHierarchyDifference(p).then((response)=>{
          if(response.data.code == "0"){
            this.$message({
              message: '加入成功',
              type: 'success'
            });
            this.getList();
          }
        });
        this.dialogVisibleLevel = false;
      },
      handleCheckedCitiesChange(value) {
        let checkedCount = value.length;
        this.checkAll = checkedCount === this.levels.length;
        this.isIndeterminate = checkedCount > 0 && checkedCount < this.levels.length;
      },
      clickCheckTheDocumentsInvestigation(type){
        // if(this.checkList == 0){
        //   this.$message({message: '请勾选数据',type: 'warning'});
        //   return;
        // }
        // for(let i=0;i<this.checkList.length;i++){
        //   if(this.checkList[i].auditStatus==1){
        //     this.$message.warning("已审核通过数据不允许再次协查！");
        //     return;
        //   }
        // }
        var ids=[];
        this.checkList.forEach(function (key, val) {
          ids[val] = key.id
        })
        let p = {
          ids : JSON.stringify(ids),
          type : type,//1为结账单据协查 2为单台设备协查
          remark : this.danTaiSheBeiXieChaData.remark
        };
        insertCheckTheDocumentsInvestigation(p).then((response)=>{
          if(response.data.code == "0"){
            this.$message({
              message: '加入成功',
              type: 'success'
            });
            this.closeDanTaiSheBeiXieCha()
            this.getList();
          }
        });
      },
      previewEditorSC_LC(row){ //回馈预览
        this.isShowDiaSC_LC=true;
        this.$nextTick(()=>{
          this.$refs.HuikuiInfoSC_LC.tableDataSource=3;
          this.$refs.HuikuiInfoSC_LC.recallShow(row.id,row,row.assistStatus);
        })
      },
      previewEditorLC_ACC(row,assistStatus){ //回馈预览
        this.isShowDiaLC_ACC=true;
        this.$nextTick(()=>{
          this.$refs.HuikuiInfoLC_ACC.tableDataSource=4;
          this.$refs.HuikuiInfoLC_ACC.recallShow(row.id,row,assistStatus);
        })
      },
      previewNotice(row){
        let th=this;
        getTvmList({relationid:row.id}).then((res)=>{
          th.data = res.data.data;
          this.dialogVisibleprev=true;
          this.$nextTick(()=>{
            this.$refs.prev.dialogVisible=true;
            this.$refs.prev.recallShow(th.data[0],this);
          })
        });
      },
      previewEditor(row,type){
        let feedbackPath="";
        let feedbackEventStr="";
        //根据主键ID查各个协查表，判断如果有回馈，就跳转到回馈，如果是未下发，跳转到下发页面(带条件)，如果下发还未回馈的，提示等待回馈
        if(1 == type){//结账单据
          feedbackPath="/subwayRat/TVMRevenueVarianceAudit/TvmChaYiDXC/TvmJiezhangdanjuxiecha/TvmJiezhangdanjuxiecha";
          getSwAuTvmDailyBillAssistList({relationid:row.id}).then((response)=>{
            if(response.data && response.data.data[0] && response.data.data[0].replyStatus == 1){//结账单 已回馈
              feedbackEventStr = "jiezhangdan_call";
            }else if(response.data && response.data.data[0] && response.data.data[0].assistInvestStatus == 1){//结账单 待下发
              feedbackEventStr = "jiezhangdan_view";
            }else if(response.data && response.data.data[0] && response.data.data[0].assistInvestStatus == 2 && response.data.data[0].replyStatus == 0){//已下发 未回馈
              this.$message({message: '已下发，等待回馈',type: 'warning'});
              return;
            }
            this.$router.push({path:feedbackPath,query:row});
            setTimeout(function () {
              transitUtil.$emit(feedbackEventStr,row);
            },100)
          });
        }else if(2 == type){//层级
          let th=this;
          getSwAuTvmCashAmountHierarchyDifferenceList({relationSourceId:row.id,type:this.levelRadio}).then((response)=>{
            // var typeCode = 'SC';
            // if(2 == this.levelRadio){//SC去掉
            //   feedbackPath="/subwayRat/TVMRevenueVarianceAudit/TvmChaYiDXC/tvmCengJiCYXC/tvmXianJinCengJiCYDXY/JieZhangDanAndSCCengji/JieZhangDanAndSCCengji";
            // }else
            var typeCode = 'SC-LC';
            if(3 == this.levelRadio){//SC-LC
              th.data = response.data.data;
              th.previewEditorSC_LC(th.data[0],3);//按照协查完毕展示
              // feedbackPath="/subwayRat/TVMRevenueVarianceAudit/TvmChaYiDXC/tvmCengJiCYXC/tvmXianJinCengJiCYDXY/ScAndLcCengJiCYDXC/ScAndLcCengJiCYDXC";
            }else if(4 == this.levelRadio){//LC-ACC
              // typeCode = 'LC-ACC';
              // feedbackPath="/subwayRat/TVMRevenueVarianceAudit/TvmChaYiDXC/tvmCengJiCYXC/tvmXianJinCengJiCYDXY/LCAndACCCengJiCYDXC/LCAndACCCengJiCYDXC";
              th.data = response.data.data;
              th.previewEditorLC_ACC(th.data[0],3);
            }
            // if(response.data && response.data.data[0] && response.data.data[0].replyStatus == 1){//层级 已回馈
            //     feedbackEventStr = typeCode + "_call";
            // }else if(response.data && response.data.data[0] && response.data.data[0].assistStatus == 1){//层级 待下发
            //   feedbackEventStr = typeCode + "_view";
            // }else if(response.data && response.data.data[0] && response.data.data[0].assistStatus == 2 && response.data.data[0].replyStatus == 0){
            //   this.$message({message: '已下发，等待回馈',type: 'warning'});
            //   return;
            // }
            // this.$router.push({path:feedbackPath,query:row});
            // setTimeout(function () {
            //   transitUtil.$emit(feedbackEventStr,row);
            // },100)
          });
        }else if(3 == type){//单台设备
          let th=this;
          // feedbackPath="/subwayRat/TVMRevenueVarianceAudit/TvmChaYiDXC/dantaishebeipiaohuanchayi/dantaishebeipiaohuanchayi";
          getSwAuTvmSingleAssistList({relationid:row.id}).then((response)=>{
            th.data = response.data.data;
            th.previewEditorDantai(th.data[0]);

            // if(response.data && response.data.data[0] && response.data.data[0].replyStatus == 1){//单台设备 已回馈
            //   feedbackEventStr = "dantai_call";
            // }else if(response.data && response.data.data[0] && response.data.data[0].assistInvestStatus == 1){//单台设备 待下发
            //   feedbackEventStr = "dantai_view";
            // }else if(response.data && response.data.data[0] && response.data.data[0].assistInvestStatus == 2 && response.data.data[0].replyStatus == 0){
            //   this.$message({message: '已下发，等待回馈',type: 'warning'});
            //   return;
            // }
            // this.$router.push({path:feedbackPath,query:row});
            // setTimeout(function () {
            //   transitUtil.$emit(feedbackEventStr,row);
            // },100)
          });
        }
        return;
      },
      previewEditorDantai(row){ //回馈预览
        this.isShowDia=true;
        this.$nextTick(()=>{
          this.$refs.HuikuiInfo.recallShow(row.id,row,3);
        })
      },
      dataSourceReplace(row){
        this.dialogVisibleLevelReplace.dialogVisible=true;
        this.dialogVisibleLevelReplace.row=row;
      },
      replaceCengJiDatasource(){ //接口来源替换
        let row=this.dialogVisibleLevelReplace.row;
        replaceCengJiDatasourceSwAuTvmCashAmountHierarchyDifference({dataSource:this.dialogVisibleLevelReplace.dataSource,id:row.id}).then(res=>{
          if(res.data.code==0){
            this.$message.success("操作成功！");
            this.getList();
            this.dialogVisibleLevelReplace.dialogVisible=false;
          }else{
            this.$message.error("操作失败！");
          }
        }).catch(e=>{
          this.$message.error("操作失败！");
        })
      },
      async clickAudit(){
        if(this.checkList == 0){
          this.$message({message: '请勾选数据后审批',type: 'warning'});
          return;
        }
        var ids=[];
        for(let i=0;i<this.checkList.length;i++){
          if(this.checkList[i].auditStatus==1){
            this.$message.warning("勾选数据中存在已审核通过数据！");
            return;
          }
          if(this.checkList[i].isModify == 0){
            // this.$message.warning("勾选数据中存在报表差错未完成的数据！");
            // return;
          } else {
            ids.push(this.checkList[i].id)
          }
        }
        let res = await this.$confirm('是否一键审核？', '提示', {
          confirmButtonText: '是',
          cancelButtonText: '否',
          type: 'warning'
        });
        if (!res) {
          return;
        }

        // this.checkList.forEach(function (key, val) {
        //   ids[val] = key.id
        // })
        let p = {
          ids : JSON.stringify(ids)
        };
        let response = await updateAuditStatusDefference(p);
        if(response.data.code == "0"){
          this.$message({
            message: '审核完成',
            type: 'success'
          });
          this.getList();
        }
      },
      async exportExcel(){ // 导出
        let p={};
        Object.assign(p,this.searchForm);
        p.pageNo=1;
        p.pageSize=1000000000;
        p.size=1000000000;
        if(this.checkList.length>0){
          let newData = JSON.parse(JSON.stringify(this.checkList));
          exportDataToExcel(newData,this.option.column,'TVM票款差异审核');
        }else {
          let res=await getFareDifferencesInAudit(p);
          let data = sortWithDiffMoney(res.data.data.records,'diffMoney');//排序 ;
          exportDataToExcel(data,this.option.column,'TVM票款差异审核');
        }
      },
      async submitDifferences(){
        this.dialogVisible = false;
        if('' != this.textarea){
          var ids=[];
          this.checkList.forEach(function (key, val) {
            ids[val] = key.id
          })
          let p = {
            textarea : this.textarea,
            ids : JSON.stringify(ids)
          };
          let response = await updateDifferences(p);
          if(response.data.code == "0"){
            this.$message({
              message: '设置成功',
              type: 'success'
            });
            this.getList();
          }else{
            this.$message({
              message: '设置失败',
              type: 'warning'
            });
          }
        }
      },
      clickDifferences(){
        if(this.checkList == 0){
          this.$message({message: '请勾选数据',type: 'warning'});
          return;
        }
        this.dialogVisible = true;
      },
      getList() {
        const params = this.$route.query;
        console.log(JSON.stringify(params))
        const p = {};
        if (Object.keys(params).length) {
          p.lineCode = params.lineCode;
          p.stationCode = params.stationCode;
          p.tvmCode = params.tvmCode;
          p.recordTime = params.reprotTime;
        }
        this.listLoading = true;
        this.page.size = this.page.pageSize;
        this.page.current = this.page.currentPage;
        Object.assign(this.searchForm,this.page);
        this.searchForm.userCode = this.$store.getters.userInfo.userCode;
	//alert(JSON.stringify(this.searchForm));
        getFareDifferencesInAudit(Object.keys(params).length ? p : this.searchForm).then((response)=>{
          // this.list = sortWithDiffMoney(response.data.data,'diffMoney');//排序
          this.list =response.data.data.records;
          this.listLoading = false;
          this.page.total=response.data.data.total;
        });
      },
      selectionChange(list){
          this.checkList = list;
      },
      handleFilter(params, done) {
        Object.assign(this.searchForm,params);
        this.getList();
        done();
      },
      clickFun(){
        //let fareDifferencesInAuditParam=this.searchForm;
        if (this.checkList.length != 1) {
          this.$message.warning("请选择一条数据！");
          return;
        }
        let fareDifferencesInAuditParam=
          {
            lineCode:this.checkList[0].lineCode,
            stationCode:this.checkList[0].stationCode,
            tvmCode:this.checkList[0].tvmCode,
            recordTime:dateFormat(new Date(this.checkList[0].recordTime)).substr(0,10)
          };
        this.$router.push({ path:'/subwayRat/TVMRevenueVarianceAudit/cashBoxBatchAudit/index',query:{fareDifferencesInAuditParam:JSON.stringify(fareDifferencesInAuditParam)}})
      },
      async submitData() {
        if (this.checkList.length != 1) {
          this.$message.warning("请选择一条要加入的数据！");
          return;
        }
        for (let i = 0; i < this.checkList.length; i++) {
          if (this.checkList[i].auditStatus == 1) {
            this.$message.warning("请选择未审核的数据！");
            return;
          }
        }
        let res = await this.$confirm('是否提交报表差错？', '提示', {
          confirmButtonText: '是',
          cancelButtonText: '否',
          type: 'warning'
        });
        if (!res) {
          return;
        }
        // this.checkList[0].reportNameId = '4';
        // this.$router.push({ path: '/subwayRat/reportMondify/reportMistakeInfo',query:{row:this.checkList[0]}})

        let param={
          resultIds:this.checkList[0].id,
          operatorTable:"sw_au_tvm_amount_defference",
          lineCode:this.checkList[0].lineCode,
          stationCode:this.checkList[0].stationCode,
          tvmCode:this.checkList[0].tvmCode,
          reprotTime:this.checkList[0].recordTime,
          reportNameId:5,
          settleBeginTime:this.checkList[0].incomeSettleBeginTime,
          settleEndTime:this.checkList[0].incomeSettleEndTime,  //站务员 attendancePersonJobNo
          userCodes: this.checkList[0].attendancePersonJobNo, //(this.checkList[0].updateJobNo)?this.checkList[0].updateJobNo:this.checkList[0].passengerJobNo,
	  dutyStationLeaderCode:this.checkList[0].passengerJobNo,
	  dutyStationLeaderName:this.checkList[0].passengerJobName,
          showType:3,
          dataSource:4,
	        errorAmount:fenExYuangettoFixed2(this.checkList[0].diffMoney)
        };
        this.$refs.addReportEditor.others_report_add_call(param);

      },

      async jiaRuNotice() { //加入通知
        if (this.checkList.length <= 0) {
          this.$message.warning("请选择要通知的数据！");
          return;
        }
        for (let i = 0; i < this.checkList.length; i++) {
          if (this.checkList[i].noticeSate > '1') {
            this.$message.warning("请选择未通知的数据！");
            return;
          }
        }
        for (let i = 0; i < this.checkList.length; i++) {
          if (this.checkList[i].auditStatus == 1) {
            this.$message.warning("请选择未审批的数据！");
            return;
          }
        }
        var ids=[];
        this.checkList.forEach(function (key, val) {
          ids[val] = key.id
        })
        let messageLSList = [];
        for(let i=0;i<this.checkList.length;i++){
          let data = await getLineAndStationByCode({"lineCode":this.checkList[i].lineCode, "code":this.checkList[i].stationCode});
          messageLSList.push({
            "content":"站点：" + data.data[0].name,
            "lineCode":this.checkList[i].lineCode,
            "stationCode":this.checkList[i].stationCode
          })
        }
        let p = {
          messageLSList:JSON.stringify(messageLSList),
          title:this.$store.getters.tag.label,
          msgType:"通知",
          type:"tvmPiaoKuanDifference_001",
          ids:JSON.stringify(ids),
          noticeType:'1'
        };
        this.$confirm('您是否要通知此数据？', '提示', {
          confirmButtonText: '是',
          cancelButtonText: '否',
          type: 'warning'
        }).then(() => {
          jiaRuNoticeTvm(p).then((res)=>{
            this.$message({
              message: res.data.code==0?'操作成功':'操作失败',
              type: res.data.code==0?'success':'error',
            });
            this.getList();
          });
        }).catch(() => {
        });
      },
      closeDialog(){
        this.editVisableDialog = false;
        for(var i=1;i<=26;i++){
          this.tableOptionEditTvm.column[i].display = false;
        }
      },
      closehandCleanDialog(){
        this.handCleanData =[];
        this.handCleanVisableDialog = false;
      },
      closeDanTaiSheBeiXieCha(){
        this.danTaiSheBeiXieChaData = {remark: ''};
        this.danTaiSheBeiXieCha = false;
      },
      closetvmCheckDialog(){
        this.coinData = [],
        this.coinChangeData = [],
        this.paperData = [],
        this.paperChangeData = [],
        this.wasteData = [],
        this.tvmCheckVisableDialog = false;
      },
      formatterAmount(row,isYuan){ //格式化钱
        if(isYuan){
          row.tvmBillCashSellTicket=fenExYuangettoFixed(row,'tvmBillCashSellTicket');
          row.tvmBillCashRecharge=fenExYuangettoFixed(row,'tvmBillCashRecharge');
          row.tvmBillCashReturn=fenExYuangettoFixed(row,'tvmBillCashReturn');
          row.scCashSellTicket=fenExYuangettoFixed(row,'scCashSellTicket');
          row.scCashRecharge=fenExYuangettoFixed(row,'scCashRecharge');
          row.scCashReturn=fenExYuangettoFixed(row,'scCashReturn');
          row.lcCashSellTicket=fenExYuangettoFixed(row,'lcCashSellTicket');
          row.lcCashRecharge=fenExYuangettoFixed(row,'lcCashRecharge');
          row.lcCashReturn=fenExYuangettoFixed(row,'lcCashReturn');
          row.accCashSellTicket=fenExYuangettoFixed(row,'accCashSellTicket');
          row.accCashRecharge=fenExYuangettoFixed(row,'accCashRecharge');
          row.accCashReturn=fenExYuangettoFixed(row,'accCashReturn');
          row.singleDeviceSysMoney=fenExYuangettoFixed(row,'singleDeviceSysMoney');
          row.boxAuditSysMoney=fenExYuangettoFixed(row,'boxAuditSysMoney');
          row.systemMoney=fenExYuangettoFixed(row,'systemMoney');
          row.actualMoney=fenExYuangettoFixed(row,'actualMoney');
          row.diffMoney=fenExYuangettoFixed(row,'diffMoney');
        }else if(!isYuan){
          row.tvmBillCashSellTicket=Number(row.tvmBillCashSellTicket)*100;
          row.tvmBillCashRecharge=Number(row.tvmBillCashRecharge)*100;
          row.tvmBillCashReturn=Number(row.tvmBillCashReturn)*100;
          row.scCashSellTicket=Number(row.scCashSellTicket)*100;
          row.scCashRecharge=Number(row.scCashRecharge)*100;
          row.scCashReturn=Number(row.scCashReturn)*100;
          row.lcCashSellTicket=Number(row.lcCashSellTicket)*100;
          row.lcCashRecharge=Number(row.lcCashRecharge)*100;
          row.lcCashReturn=Number(row.lcCashReturn)*100;
          row.accCashSellTicket=Number(row.accCashSellTicket)*100;
          row.accCashRecharge=Number(row.accCashRecharge)*100;
          row.accCashReturn=Number(row.accCashReturn)*100;
          row.singleDeviceSysMoney=Number(row.singleDeviceSysMoney)*100;
          row.boxAuditSysMoney=Number(row.boxAuditSysMoney)*100;
          row.systemMoney=Number(row.systemMoney)*100;
          row.actualMoney=Number(row.actualMoney)*100;
          row.diffMoney=Number(row.diffMoney)*100;
        }
        return row;
      },
      rowEditor: function (row,type) {
        if(type==1){
          this.tableOptionEditTvm.column[1].display = true;
          this.tableOptionEditTvm.column[2].display = true;
          this.tableOptionEditTvm.column[3].display = true;
          this.tableOptionEditTvm.column[4].display = true;
          this.tableOptionEditTvm.column[5].display = true;
          this.tableOptionEditTvm.column[6].display = true;
          this.editVisableDialog = true;
        }else if(type==2){
          this.tableOptionEditTvm.column[7].display = true;
          this.tableOptionEditTvm.column[8].display = true;
          this.tableOptionEditTvm.column[9].display = true;
          this.tableOptionEditTvm.column[10].display = true;
          this.tableOptionEditTvm.column[11].display = true;
          this.tableOptionEditTvm.column[12].display = true;
          this.editVisableDialog = true;
        }else if(type==3){
          this.tableOptionEditTvm.column[13].display = true;
          this.tableOptionEditTvm.column[14].display = true;
          this.tableOptionEditTvm.column[15].display = true;
          this.tableOptionEditTvm.column[16].display = true;
          this.tableOptionEditTvm.column[17].display = true;
          this.tableOptionEditTvm.column[18].display = true;
          this.editVisableDialog = true;
        }else if(type==4){
          this.tableOptionEditTvm.column[19].display = true;
          this.tableOptionEditTvm.column[20].display = true;
          this.tableOptionEditTvm.column[21].display = true;
          this.tableOptionEditTvm.column[22].display = true;
          this.tableOptionEditTvm.column[23].display = true;
          this.tableOptionEditTvm.column[24].display = true;
          this.editVisableDialog = true;
        }else if(type==5){
          this.tableOptionEditTvm.column[25].display = true;
          this.editVisableDialog = true;
        }else if(type==6){
          this.tableOptionEditTvm.column[26].display = true;
          this.editVisableDialog = true;
        };
        //this.formEdit = row;
        this.formEdit.id = row.id;
        this.formEdit.dataSource = row.dataSource;
        this.formEdit.tvmBillCashSellTicket = row.tvmBillCashSellTicket;
        this.formEdit.tvmBillCashRecharge = row.tvmBillCashRecharge;
        this.formEdit.tvmBillCashReturn = row.tvmBillCashReturn;
        this.formEdit.scCashSellTicket = row.scCashSellTicket;
        this.formEdit.scCashRecharge = row.scCashRecharge;
        this.formEdit.scCashReturn = row.scCashReturn;
        this.formEdit.lcCashSellTicket = row.lcCashSellTicket;
        this.formEdit.lcCashRecharge = row.lcCashRecharge;
        this.formEdit.lcCashReturn = row.lcCashReturn;
        this.formEdit.accCashSellTicket = row.accCashSellTicket;
        this.formEdit.accCashRecharge = row.accCashRecharge;
        this.formEdit.accCashReturn = row.accCashReturn;
        this.formEdit.singleDeviceSysMoney = row.singleDeviceSysMoney;
        this.formEdit.boxAuditSysMoney = row.boxAuditSysMoney;
        this.formEdit.systemMoney = row.systemMoney;
        this.formEdit.actualMoney = row.actualMoney;
        this.formEdit.diffMoney = row.diffMoney;
        this.formEdit.reasonRemark = row.reasonRemark;
        this.$nextTick(() => {
          this.formatterAmount(this.formEdit,true);
        })
      },
      edit(){
        if(this.formEdit.reasonRemark == '' || this.formEdit.reasonRemark == undefined || this.formEdit.reasonRemark == null){
            this.$message.error('修改原因备注不能为空！');
            return
        }
        this.formatterAmount(this.formEdit,false);
        update(this.formEdit).then(data => {
            this.$message.success('编辑成功！');
            this.closeDialog();
            this.getList();
          }).catch(() => {

          });
      },
      //审核通过的才能撤回
      revoke: function () {
        if (this.checkList.length === 0) {
          this.$message.error('请选择要撤回的数据！');
          return;
        }
        for(let i =0;i<this.checkList.length;i++){
          if(this.checkList[i].auditStatus==0){
            this.$message.warning("只能撤回审批通过的数据！");
            return;
          }
        }
        var ids=[];
        this.checkList.forEach(function (key, val) {
          ids[val] = key.id
        })
        this.$confirm("是否需要撤回?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "success"
        }).then(() => {
          revoke({ids: ids})
            .then(data => {
              if (data.data.code == "0") {
                this.$message.success("撤回成功！");
              }
              this.getList(this.page);
              done();
            })
            .catch(() => {
              loading();
            });
        });
      },
    }
  }
</script>
<style lang="scss">
  .cashboxUninstall {
    height: 100%;

    &__tree {
      padding-top: 3px;
      padding-right: 20px;
    }

    &__main {
      .el-card__body {
        padding-top: 0;
      }
    }
  }
  .bottom-menu{
    text-align: center;
  }
  .bottom-menu-tvm{
    text-align: center;
    margin-top: 10px;
  }
  .bottom-menu-close{
    text-align: center;
    margin-top: 50px;
  }
  .bottom-menu-hand{
    text-align: center;
    margin-top: 50px;
  }
  .custom-textarea .el-textarea__inner {
    height: 100px; /* 设置你想要的高度 */
  }
</style>
